<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
        width: 300px;
        height: 100px;
        border: 1px solid black;
        position: relative;
        }
        .jiang{
            color: red;
            font-size: 30px;
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%,-50%);
        }
        .canvas{
            position: absolute;
        }
    </style>
    
</head>
<body>
    <div class="box">
         <p class="jiang">谢谢惠顾</p>
         <canvas class="canvas" width="300" height="100"></canvas>
    </div>
    <script>
      var jiang=document.querySelector(".jiang")
      var jiangxiang=["100元","200元","300元","谢谢惠顾","谢谢惠顾","谢谢惠顾","谢谢惠顾"]
      var num=Math.floor(Math.random()*(jiangxiang.length-1 - 0 + 1)+0)
      jiang.innerHTML=jiangxiang[num]
      var canvas=document.querySelector(".canvas")
      var ctx= canvas.getContext("2d")
      ctx.fillStyle="#999d9c"
      ctx.fillRect(0,0,300,100)
      canvas.onmousedown=function(){
        canvas.onmousemove=function(e){
             ctx.clearRect(e.offsetX,e.offsetY,10,10)
        }
      }
      canvas.onmouseup=function(){
        canvas.onmousemove=null
      }
    </script>
</body>
</html>